import { useMenuStore } from '@/store';

export default function usePermission() {
  const { getResourceGroupList } = useMenuStore();
  const checkPermission = (role: string[] | string): boolean => {
    if (Array.isArray(role)) {
      return role.some((el) => (getResourceGroupList as unknown as string[]).includes(el));
    }
    return (getResourceGroupList as unknown as string[]).includes(role);
  };
  return {
    checkPermission,
  };
}
